package edu.zut.main.thread;

//线程联合   相当于插队
public class ThreadJoin {

    public static void main(String[] args) {
        //vip线程
        VIPThread vipThread = new VIPThread();
        Thread thread = new Thread(vipThread);
        thread.start();


        for (int i = 1; i <= 300; i++) {
            if (i == 100){
                try {
                    //线程的联合  会获取当前正在执行线程的cpu资源
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("普通客户" + i + "该你了");
        }
    }

}
//银行办业务，vip插队
class VIPThread implements Runnable{

    @Override
    public void run() {
        for (int i = 1; i < 11; i++) {
            System.out.println("VIP" + i + "插队");
        }

    }
}


